<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>15-属性值计算calc</title>
  <style>
    .father {
      width: 300px;
      height: 200px;
      background: pink;
    }

    .son {
      /* width: calc(150px + 30px); */
      /* 父亲盒子宽度获取100%-30像素 也就是永远会比父亲小30像素 */
      width: calc(100% - 30px);
      height: 30px;
      background: purple;
    }
  </style>
</head>

<body>
  <!-- 需求我们的子盒子宽度永远比父盒子小30像素 -->
  <div class="father">
    <div class="son"></div>
  </div>
</body>

</html>